#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"

int main (int argc, char* argv[])
{

  try
    {

	    cv::gpu::resetDevice();

        cv::Mat src_host = cv::imread("/home/erman/cuda-workspace/DisplayImage/src/imageErman.jpg", CV_LOAD_IMAGE_GRAYSCALE);



        if(src_host.empty())
        {
        	std::cerr << "Can't load image";
            exit(-1);

        }

        cv::gpu::GpuMat dst, src;



        src.upload(src_host);


        cv::gpu::rotate(src, dst, src.size(), 180,src.size().width , src.size().height, 1); //
        cv::gpu::threshold(dst, dst, 128.0, 255.0, CV_THRESH_BINARY);



        cv::Mat result_host, result_hist;

        dst.download(result_host);

        cv::imshow("Result", result_host);
        cv::waitKey();
    }
    catch(const cv::Exception& ex)
    {
       std::cout << "Error: " << ex.what() << std::endl;
    }
    return 0;
}
